﻿using StoCombatLogHUD.Parsing;

namespace StoCombatLogHUD.Statistics.StatisticsEntries
{
	/// <summary>
	/// Useful extensions for <see cref="IStatisticsEntry"/>.
	/// </summary>
	public static class IStatisticsEntryExtensions
	{
		/// <summary>
		/// Percentages the specified statistics entry.
		/// </summary>
		/// <param name="statisticsEntry">The statistics entry.</param>
		/// <param name="flags">The flags.</param>
		/// <returns></returns>
		public static double Percentage(this IStatisticsEntry statisticsEntry, CombatLogEntry.CombatFlags flags)
		{
			return 100.0*statisticsEntry.Count(flags)/statisticsEntry.Count(CombatLogEntry.CombatFlags.Any);
		}
	}
}
